import com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2024-12-09
 * Time: 21:46
 */
public class JDBCDemo7 {
    public static boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {

        Thread t = new Thread(() -> {
            while (!isQuit) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }) ;
        t.start();

        Thread.sleep(3000);

        isQuit = true;
        System.out.println("把 t 线程终止");

    }
}
